
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<div class="header">
  <div class="title"><a href="index.html" style="text-decoration: none; color: black;">Simple Raid Signup</a></div>
	 <div class="userArea">
	   <div>You are logged in as:</div>
	   <div><b><sec:authentication property="name" /></b></div>
	   <div><span><a href="profile.html">My Profile</a></span><span><a href="/logout.html">Log out</a></span></div>
	 </div>
	 <div id="notificationArea">

	 </div>
	 <script type="text/javascript">
	 	function addNotificationMessage(msg, x) {
	 		addMessage('ui-state-highlight', msg, x);
	 	}
	 	
		function addErrorMessage(msg, x) {
			addMessage('ui-state-error', msg, x);
	 	}
	 
 		function addMessage(className, msg, x) {
 			if (typeof(x) == 'boolean') {
 				var sticky = x;
 			} else if(typeof(x) == 'number') {
 				var timeout = x;
 			}
 			
 			var msgElem = document.createElement("div");
 			msgElem.setAttribute('class', className + (sticky ? ' message-sticky' : ''));
 			if (sticky) {
 				var closeButton = document.createElement("button");
 				msgElem.appendChild(closeButton);
 				$(closeButton).button({ icons: {primary: "ui-icon-closethick",},text: false});
 				$(closeButton).click({ref:msgElem},function (e) {
 					e.data.ref.parentNode.removeChild(e.data.ref);
 				});
 			} else if(timeout) {
 				setTimeout(function () {if (msgElem.parentNode != null) {$(msgElem).fadeOut("fast", function () {msgElem.parentNode.removeChild(msgElem);});}}, timeout);
 			}
 			var msgP = document.createElement("p");
 			msgP.innerHTML=msg;
 			msgElem.appendChild(msgP);
 			$('#notificationArea div').not('.message-sticky').remove()
 			$('#notificationArea').append(msgElem);
 			$(msgElem).fadeIn("fast");
 		}
 	</script>
  <div class="clear"></div>
</div>